<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\records\Toy;

/* @var $this yii\web\View */
/* @var $model common\models\Comment */
/* @var $form yii\widgets\ActiveForm */
$toys = Toy::find()->select("id, name")->where([])->asArray()->all();
$toy_ids = array();
foreach($toys AS $item)
{
    $toy_ids[$item['id']] = $item['name'];
}

?>

<div class="box box-primary">
    <div class="box-body">
        <?php $form = ActiveForm::begin(); ?>

        <?= $form->field($model, 'mid')->textInput() ?>
        <?= $form->field($model, 'toy_id')->dropDownList($toy_ids, ['prompt' => '请选择']) ?>
        <?= $form->field($model, 'coin')->textInput() ?>
        <?= $form->field($model, 'left_toy')->textInput() ?>
        <?= $form->field($model, 'address')->textInput() ?>
        <?= $form->field($model, 'description')->textarea()?>
        <div class="form-group">
            <?= Html::submitButton($model->isNewRecord ? '创建' : '更新', ['class' => $model->isNewRecord ? 'btn btn-success btn-flat btn-block' : 'btn btn-primary btn-flat btn-block']) ?>
        </div>

        <?php ActiveForm::end(); ?>
    </div>
</div>
